#ifndef __N76E003_IAP_H
#define __N76E003_IAP_H

#include "mcu_cfg.h"

#define     CID_READ            0x0B
#define     DID_READ            0x0C
#define     CFG_READ            0xC0
#define     CFG_ERASE           0xE2

#define     PAGE_ERASE_AP       0x22
#define     BYTE_READ_AP        0x00
#define     BYTE_PROGRAM_AP     0x21

#define     BYTE_PROGRAM_CFG    0xE1
#define     BYTE_READ_CFG       0xC0

#define     PAGE_SIZE           128

#define     APROM_SIZE          8192   
#define     APROM_START_ADDR    0x0000

#define     ERASE_FAIL          0x70
#define     PROGRAM_FAIL        0x71
#define     IAPFF_FAIL          0x72
#define     IAP_PASS            0x00
#define     FLASH_BLOCK_SIZE	0x80

extern void IAP_Cmd_Proc(void);
extern void Cmd_Jump2Init(void);
extern void Cmd_Jump2Active(void);
void Cmd_ReadInfo(void);

void FLASH_EraseBlock_a(u16 addres);
void FLASH_ProgramData(u16 addres, u8 *Buffer, u8 p_size, u8 mode);

#endif

